<?php

declare(strict_types=1);

namespace ImiApp\ApiServer\Api\Model\Base;

use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use ImiApp\ImiServer\AbstractModel as Model;


use Imi\Model\Annotation\Relation\OneToOne;
use Imi\Model\Annotation\Relation\JoinFrom;
use Imi\Model\Annotation\Relation\JoinTo;
use Imi\Model\Annotation\Relation\AutoSave;
use Imi\Model\Annotation\Relation\AutoDelete;
use ImiApp\ApiServer\Api\Model\Goodscate;

/**
 * 商品参数模版 基类.
 * @property \ImiApp\ApiServer\Api\Model\Goodscate $ex
 * @Entity(camel=false, bean=true, incrUpdate=false)
 * @Table(name=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Goodsparam.name", default="fa_goodsparam"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Goodsparam.poolName"))
 * @DDL(sql="CREATE TABLE `fa_goodsparam` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(30) NOT NULL DEFAULT '',
  `goodscate_id` int(10) NOT NULL COMMENT '商品分类',
  `weigh` int(10) DEFAULT '0' COMMENT '权重',
  `description` varchar(255) DEFAULT '' COMMENT '描述',
  `deletetime` bigint(16) DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `weigh_id` (`weigh`,`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品参数模版'", decode="")
 *
 * @property int|null $id 
 * @property string|null $name 
 * @property int|null $goodscateId 商品分类
 * @property int|null $weigh 权重
 * @property string|null $description 描述
 * @property int|null $deletetime 
 */
abstract class GoodsparamBase extends Model
{
    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEY = 'id';

    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEYS = ["id"];








    /**
     * @OneToOne("Goodscate")
     * @JoinFrom("Goodscate_id")
     * @JoinTo("id")
     */
    protected ?\ImiApp\ApiServer\Api\Model\Goodscate $ex = null;



    /**
     * Get the value of ex
     */
    public function getEx(): ?\ImiApp\ApiServer\Api\Model\Goodscate
    {
        return $this->ex;
    }
 
    /**
     * Set the value of ex
     *
     * @return  self
     */
    public function setEx(?\ImiApp\ApiServer\Api\Model\Goodscate $ex)
    {
        $this->ex = $ex;
 
        return $this;
    }



    /**
     * id.
     * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $id = NULL;

    /**
     * 获取 id.
     *
     * @return int|null
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * 赋值 id.
     * @param int|null $id id
     * @return static
     */
    public function setId($id)
    {
        $this->id = null === $id ? null : (int)$id;
        return $this;
    }

    /**
     * name.
     * @Column(name="name", type="varchar", length=30, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $name = '';

    /**
     * 获取 name.
     *
     * @return string|null
     */
    public function getName(): ?string
    {
        return $this->name;
    }

    /**
     * 赋值 name.
     * @param string|null $name name
     * @return static
     */
    public function setName($name)
    {
        $this->name = null === $name ? null : (string)$name;
        return $this;
    }

    /**
     * 商品分类.
     * goodscate_id
     * @Column(name="goodscate_id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $goodscateId = NULL;

    /**
     * 获取 goodscateId - 商品分类.
     *
     * @return int|null
     */
    public function getGoodscateId(): ?int
    {
        return $this->goodscateId;
    }

    /**
     * 赋值 goodscateId - 商品分类.
     * @param int|null $goodscateId goodscate_id
     * @return static
     */
    public function setGoodscateId($goodscateId)
    {
        $this->goodscateId = null === $goodscateId ? null : (int)$goodscateId;
        return $this;
    }

    /**
     * 权重.
     * weigh
     * @Column(name="weigh", type="int", length=10, accuracy=0, nullable=true, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $weigh = 0;

    /**
     * 获取 weigh - 权重.
     *
     * @return int|null
     */
    public function getWeigh(): ?int
    {
        return $this->weigh;
    }

    /**
     * 赋值 weigh - 权重.
     * @param int|null $weigh weigh
     * @return static
     */
    public function setWeigh($weigh)
    {
        $this->weigh = null === $weigh ? null : (int)$weigh;
        return $this;
    }

    /**
     * 描述.
     * description
     * @Column(name="description", type="varchar", length=255, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $description = '';

    /**
     * 获取 description - 描述.
     *
     * @return string|null
     */
    public function getDescription(): ?string
    {
        return $this->description;
    }

    /**
     * 赋值 description - 描述.
     * @param string|null $description description
     * @return static
     */
    public function setDescription($description)
    {
        $this->description = null === $description ? null : (string)$description;
        return $this;
    }

    /**
     * deletetime.
     * @Column(name="deletetime", type="bigint", length=16, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $deletetime = NULL;

    /**
     * 获取 deletetime.
     *
     * @return int|null
     */
    public function getDeletetime(): ?int
    {
        return $this->deletetime;
    }

    /**
     * 赋值 deletetime.
     * @param int|null $deletetime deletetime
     * @return static
     */
    public function setDeletetime($deletetime)
    {
        $this->deletetime = null === $deletetime ? null : (int)$deletetime;
        return $this;
    }

}
